import { BookQueryList, BookQuery } from "@/type";
import qs from "qs";
import request from "@/utils/request";

export async function getBookList(params?: BookQueryList) {
    // const res = await axios(`https://mock.apifox.cn/m1/2398938-0-default/api/books?${qs.stringify(params)}`)
    return request.get(`/api/books?${qs.stringify(params)}`)
}

export async function bookAdd(params?: BookQuery) {
    return request.post('/api/books', params);
}

export async function bookDelete(id?: string) {
    return request.delete(`/api/books/${id}`);
}

export async function getBookDetails(id?: string) {
    return request.get(`/api/books/${id}`);
}

export async function bookUpdate(id: string, params: BookQuery) {
    return request.put(`/api/books/${id}`, params);
}